import {Component, Input, OnInit} from "@angular/core";
import {ViewCell} from "ng2-smart-table";

@Component({
  template: `
    {{renderValue}}
  `,
})
export class CustomTimeRender implements ViewCell, OnInit {

  renderValue: string;

  @Input() value: string | number;
  @Input() rowData: any;

  constructor(){}

  ngOnInit() {
    const date = new Date(this.value.toString());
    this.renderValue = (date.getHours()<10?'0'+date.getHours():date.getHours())+' : '+(date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes());
  }
}
